
define(['ionic', 'controllers'], function () {
    angular.module('U9Mobile.controllers')
        .controller('UserCtrl', ['$scope', 'UserService', 'ConnectService', 'UtilService', 'AppConstants',
            function ($scope, UserService, ConnectService, UtilService, AppConstants) {
                $scope.data = {
                    user: {}
                };

                $scope.$on('$ionicView.beforeEnter', function () {
                    UserService.loginPromise.then(updateUserInfo);
                });

                function updateUserInfo() {
                    $scope.data.user = UserService.getUserDetailInfo();
                }
            }
        ]);
});